package test.unitPath;

import java.util.ArrayList;

import pathfinding.grid.GridLocation;
import pathfinding.grid.GridPath;

import castledefense.data.Resources;
import castledefense.logic.Map;
import castledefense.logic.units.Unit;

import com.badlogic.gdx.graphics.g2d.SpriteBatch;

public class RenderUnitPath {
	
	public static void draw(Map map, SpriteBatch batch) {
		final ArrayList<Unit> unitList = map.getUnitList();
		
		
		for(int i=0; i<unitList.size(); i++){
			GridPath path = unitList.get(i).getPath();
			while(path != null && path.hasNextMove()){
				GridLocation location = path.getNextMove();
				float posX = (float) (location.getMinX() * Map.cellWidth);
				float posY = (float) (location.getMinY() * Map.cellWidth);
				
				batch.draw(Resources.selectedIm, posX, posY, Map.cellWidth,
						Map.cellWidth);
			}
		}
	}

}
